package client.comm.baoding.adapter.page

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import client.comm.baoding.fragment.RechargeOrderOneFragment
import client.comm.baoding.fragment.RechargeOrderZeroFragment

class RechargeOrderPageAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {

    override fun getItem(position: Int): Fragment {

        return when (position) {
            0 -> RechargeOrderZeroFragment()
            1 -> RechargeOrderOneFragment()
            else -> RechargeOrderZeroFragment()
        }
    }

    override fun getCount(): Int {
        return 2
    }

    override fun getPageTitle(position: Int): CharSequence? {
        var title = ""
        when (position) {
            0 -> {
                title = "待支付"
            }
            1 -> {
                title = "已完成"
            }
        }
        return title
    }
}